package com.xxdemo.quickstart;

import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@org.mapstruct.Mapper(componentModel = "spring")
public interface CustomerDtoCopier {
    CustomerDtoCopier INSTANCE =
            Mappers.getMapper(CustomerDtoCopier.class);

    /**
     * 类型转换：CustomerDto <--- Customer
     *
     * @param originCustomer 转换前的数据库实体Customer顾客信息
     * @return 转换后的 DTO 对象
     */
    @Mapping(target = "dob", dateFormat = "yyyy-MM-dd")
    CustomerDto copyFrom(Customer originCustomer);

    List<CustomerDto> copyFrom(List<Customer> originCustomerList);
}
